
<template>
  <div style="padding: 20px">
    <p v-for="(item, index) in dataList" :key="index">
      {{ item.title }}{{ item.value?'：':'' }}{{ item.value }}
    </p>
  </div>
</template>

<script>
export default {
  name: 'CheckItem',
  layout: 'none',
  auth: false,

  asyncData ({ route }) {
    const { j = '{}' } = route.query
    const data = {
      title: '查看二维码'
    }
    const dataList = []
    try {
      const Obj = JSON.parse(j)
      for (const title in Obj) {
        dataList.push({ title, value: Obj[title] })
      }
      if (Obj.t) data.title = Obj.t
    } catch (e) {
      dataList.push({ '暂无数据': '' })
    }
    data.dataList = dataList

    return data
  },
  data () {
    return {
      dataList: [{ '暂无数据': '' }],
      title: '查看二维码'
    }
  },
  head () {
    return {
      title: this.title
    }
  }
}
</script>
